﻿using LearnFreeSql.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LearnFreeSql
{
	public static class Query<T> where T : BasePoco
	{
		public static string SelectToSql()
		{
			return Configure.FSql.Select<T>().ToSql();
		}

		public static string SelectCountToSql()
		{
			long count;
			return Configure.FSql.Select<T>().Count(out count).Page(1, 20).ToSql();
		}

		public static string SelectID()
		{
			return Configure.FSql.Select<T>().WhereIf(true, x => x.ID == 1).ToSql();
		}

		public static string SelectNew()
		{
			return Configure.FSql.Select<T>().WhereIf(true, x => x.ID == 1).ToSql(x => x.ID);
		}
	}
}
